<?php if (!defined('THINK_PATH')) exit();?><!doctype html>
<html>
<head>
    <meta charset="UTF-8">
    <title><?php echo ($meta_title); ?>|OneThink管理平台</title>
    <link href="/Fund/Public/favicon.ico" type="image/x-icon" rel="shortcut icon">
    <link rel="stylesheet" type="text/css" href="/Fund/Public/Admin/css/base.css" media="all">
    <link rel="stylesheet" type="text/css" href="/Fund/Public/Admin/css/common.css" media="all">
    <link rel="stylesheet" type="text/css" href="/Fund/Public/Admin/css/module.css">
    <link rel="stylesheet" type="text/css" href="/Fund/Public/Admin/css/style.css" media="all">
	<link rel="stylesheet" type="text/css" href="/Fund/Public/Admin/css/<?php echo (C("COLOR_STYLE")); ?>.css" media="all">
     <!--[if lt IE 9]>
    <script type="text/javascript" src="/Fund/Public/static/jquery-1.10.2.min.js"></script>
    <![endif]--><!--[if gte IE 9]><!-->
    <script type="text/javascript" src="/Fund/Public/static/jquery-2.0.3.min.js"></script>
    <script type="text/javascript" src="/Fund/Public/Admin/js/jquery.mousewheel.js"></script>
    <!--<![endif]-->
    
	<link href="/Fund/Public/static/jquery-datetimepicker/jquery-datetimepicker.css" rel="stylesheet" media="screen">
	<link rel="stylesheet" href="/Fund/Public/static/kindeditor/default/default.css" />

</head>
<body>
    <!-- 头部 -->
    <div class="header">
        <!-- Logo -->
        <span class="logo"></span>
        <!-- /Logo -->

        <!-- 主导航 -->
        <ul class="main-nav">
            <?php if(is_array($__MENU__["main"])): $i = 0; $__LIST__ = $__MENU__["main"];if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$menu): $mod = ($i % 2 );++$i;?><li class="<?php echo ((isset($menu["class"]) && ($menu["class"] !== ""))?($menu["class"]):''); ?>"><a href="<?php echo (U($menu["url"])); ?>"><?php echo ($menu["title"]); ?></a></li><?php endforeach; endif; else: echo "" ;endif; ?>
        </ul>
        <!-- /主导航 -->

        <!-- 用户栏 -->
        <div class="user-bar">
            <a href="javascript:;" class="user-entrance"><i class="icon-user"></i></a>
            <ul class="nav-list user-menu hidden">
                <li class="manager">你好，<em title="<?php echo session('user_auth.username');?>"><?php echo session('user_auth.username');?></em></li>
                <li><a href="<?php echo U('User/updatePassword');?>">修改密码</a></li>
                <li><a href="<?php echo U('User/updateNickname');?>">修改昵称</a></li>
                <li><a href="<?php echo U('Public/logout');?>">退出</a></li>
            </ul>
        </div>
    </div>
    <!-- /头部 -->

    <!-- 边栏 -->
    <div class="sidebar">
        <!-- 子导航 -->
        
            <div id="subnav" class="subnav">
                <?php if(!empty($_extra_menu)): ?>
                    <?php echo extra_menu($_extra_menu,$__MENU__); endif; ?>
                <?php if(is_array($__MENU__["child"])): $i = 0; $__LIST__ = $__MENU__["child"];if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$sub_menu): $mod = ($i % 2 );++$i;?><!-- 子导航 -->
                    <?php if(!empty($sub_menu)): if(!empty($key)): ?><h3><i class="icon icon-unfold"></i><?php echo ($key); ?></h3><?php endif; ?>
                        <ul class="side-sub-menu">
                            <?php if(is_array($sub_menu)): $i = 0; $__LIST__ = $sub_menu;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$menu): $mod = ($i % 2 );++$i;?><li>
                                    <a class="item" href="<?php echo (U($menu["url"])); ?>"><?php echo ($menu["title"]); ?></a>
                                </li><?php endforeach; endif; else: echo "" ;endif; ?>
                        </ul><?php endif; ?>
                    <!-- /子导航 --><?php endforeach; endif; else: echo "" ;endif; ?>
            </div>
        
        <!-- /子导航 -->
    </div>
    <!-- /边栏 -->

    <!-- 内容区 -->
    <div id="main-content">
        <div id="top-alert" class="fixed alert alert-error" style="display: none;">
            <button class="close fixed" style="margin-top: 4px;">&times;</button>
            <div class="alert-content">这是内容</div>
        </div>
        <div id="main" class="main">
            
            <!-- nav -->
            <?php if(!empty($_show_nav)): ?><div class="breadcrumb">
                <span>您的位置:</span>
                <?php $i = '1'; ?>
                <?php if(is_array($_nav)): foreach($_nav as $k=>$v): if($i == count($_nav)): ?><span><?php echo ($v); ?></span>
                    <?php else: ?>
                    <span><a href="<?php echo ($k); ?>"><?php echo ($v); ?></a>&gt;</span><?php endif; ?>
                    <?php $i = $i+1; endforeach; endif; ?>
            </div><?php endif; ?>
            <!-- nav -->
            

            
    <div class="main-title">
        <h2><?php echo ($_title); ?></h2>
    </div>
    <?php if(!empty($trader)): ?><form action="<?php echo U('Trader/editTrader');?>" method="post" class="form-horizontal">
    		<input type="hidden" name="id" value="<?php echo ($trader["id"]); ?>" />
    <?php else: ?>
	    <form action="<?php echo U('Trader/addTrader');?>" method="post" class="form-horizontal"><?php endif; ?>
        <div class="form-item">
            <label class="item-label">名称<span class="check-tips">（基金经理真实姓名）</span></label>
            <div class="controls">
                <input type="text" class="text input-large" name="name" value="<?php echo ((isset($trader["name"]) && ($trader["name"] !== ""))?($trader["name"]):''); ?>">
            </div>
        </div>
        <div class="form-item">
            <label class="item-label">性别<span class="check-tips"></span></label>
            <div class="controls">
            	<select name="sex" class="input-large">
            		<?php if(is_array(C("SEX"))): foreach(C("SEX") as $key=>$val): if($key == $trader['sex']): ?><option value="<?php echo ($key); ?>" selected><?php echo ($val); ?></option>
			           	<?php else: ?>
	            			<option value="<?php echo ($key); ?>"><?php echo ($val); ?></option><?php endif; endforeach; endif; ?>
            	</select>
            </div>
        </div>
        <div class="form-item">
            <label class="item-label">出生日期<span class="check-tips"></span></label>
            <div class="controls">
                <input type="text" class="text input-large date_picker"  readonly name="birthday" value="<?php echo date('Y-m-d', $trader['birthday']);?>">
            </div>
        </div>
        <div class="form-item">
            <label class="item-label">学历<span class="check-tips"></span></label>
            <div class="controls">
            	<select name="education" class="input-large">
            		<?php if(is_array(C("EDUCATION"))): foreach(C("EDUCATION") as $key=>$val): if($key == $trader['education']): ?><option value="<?php echo ($key); ?>" selected><?php echo ($val); ?></option>
			           	<?php else: ?>
	            			<option value="<?php echo ($key); ?>"><?php echo ($val); ?></option><?php endif; endforeach; endif; ?>
            	</select>
            </div>
        </div>
        <div class="form-item">
            <label class="item-label">手机<span class="check-tips">（不可重复）</span></label>
            <div class="controls">
                <input type="text" class="text input-large" name="mobile" value="<?php echo ((isset($trader["mobile"]) && ($trader["mobile"] !== ""))?($trader["mobile"]):''); ?>">
            </div>
        </div>
         <div class="form-item">
            <label class="item-label">选择头像<span class="check-tips"><a href="<?php echo U('File/addFile', array('file_type' => 6));?>">上传头像</a></span></label>
            <div class="controls">
               <div class="div-desc" id="avatar_id" style="width:500px;float:left;margin-right:10px;overflow-y:auto"></div>
               <div class="div-desc" style="width:500px;float:left;" id="yu_lan"></div>
            </div>
        </div>
        <div class="form-item">
            <label class="item-label">基金管理年限<span class="check-tips">（基金经理从事基金管理的年限）</span></label>
            <div class="controls">
                <input type="text" class="text input-large" name="year" value="<?php echo ((isset($trader["year"]) && ($trader["year"] !== ""))?($trader["year"]):''); ?>">
            </div>
        </div>
        
        <div class="form-item">
            <label class="item-label">管理基金产品数量<span class="check-tips">（基金经理目前管理的基金产品数量）</span></label>
            <div class="controls">
                <input type="text" class="text input-large" name="count" value="<?php echo ((isset($trader["count"]) && ($trader["count"] !== ""))?($trader["count"]):''); ?>">
            </div>
        </notempty>
        
        <div class="form-item">
            <label class="item-label">QQ<span class="check-tips"></span></label>
            <div class="controls">
                <input type="text" class="text input-large" name="qq" value="<?php echo ((isset($trader["qq"]) && ($trader["qq"] !== ""))?($trader["qq"]):''); ?>">
            </div>
        </div>
        <div class="form-item">
            <label class="item-label">微信<span class="check-tips"></span></label>
            <div class="controls">
                <input type="text" class="text input-large" name="weixin" value="<?php echo ((isset($trader["weixin"]) && ($trader["weixin"] !== ""))?($trader["weixin"]):''); ?>">
            </div>
        </div>
        <div class="form-item">
            <label class="item-label">基金经理概要<span class="check-tips"></span></label>
            <div class="controls">
            	<textarea class="div-desc" name="abstract"><?php echo ((isset($trader["abstract"]) && ($trader["abstract"] !== ""))?($trader["abstract"]):''); ?></textarea>
            </div>
        </div>
        <div class="form-item">
            <label class="item-label">基金经理风格<span class="check-tips"></span></label>
            <div class="controls">
            	<textarea class="div-desc" name="abstract1"><?php echo ((isset($trader["abstract1"]) && ($trader["abstract1"] !== ""))?($trader["abstract1"]):''); ?></textarea>
            </div>
        </div>
        <div class="form-item">
            <label class="item-label">基金经理业绩<span class="check-tips"></span></label>
            <div class="controls">
            	<textarea class="div-desc" name="abstract2"><?php echo ((isset($trader["abstract2"]) && ($trader["abstract2"] !== ""))?($trader["abstract2"]):''); ?></textarea>
            </div>
        </div>
        <div class="form-item">
            <label class="item-label">基金经理简介<span class="check-tips"></span></label>
            <div class="controls">
            	<textarea class="input-large kind-editor" name="brief"><?php echo ((isset($trader["brief"]) && ($trader["brief"] !== ""))?($trader["brief"]):''); ?></textarea>
            </div>
        </div>
        
        <div class="form-item">
            <button class="btn submit-btn ajax-post" id="submit" type="submit" target-form="form-horizontal">确 定</button>
            <button class="btn btn-return" onclick="javascript:history.back(-1);return false;">返 回</button>
        </div>
    </form>

        </div>
        <div class="cont-ft">
            <div class="copyright">
                <div class="fl">感谢使用<a href="http://www.onethink.cn" target="_blank">OneThink</a>管理平台</div>
                <div class="fr">V<?php echo (ONETHINK_VERSION); ?></div>
            </div>
        </div>
    </div>
    <!-- /内容区 -->
    <script type="text/javascript">
    (function(){
        var ThinkPHP = window.Think = {
            "ROOT"   : "/Fund", //当前网站地址
            "APP"    : "/Fund/admin.php?s=", //当前项目地址
            "PUBLIC" : "/Fund/Public", //项目公共目录地址
            "DEEP"   : "<?php echo C('URL_PATHINFO_DEPR');?>", //PATHINFO分割符
            "MODEL"  : ["<?php echo C('URL_MODEL');?>", "<?php echo C('URL_CASE_INSENSITIVE');?>", "<?php echo C('URL_HTML_SUFFIX');?>"],
            "VAR"    : ["<?php echo C('VAR_MODULE');?>", "<?php echo C('VAR_CONTROLLER');?>", "<?php echo C('VAR_ACTION');?>"]
        }
    })();
    </script>
    <script type="text/javascript" src="/Fund/Public/static/think.js"></script>
    <script type="text/javascript" src="/Fund/Public/Admin/js/common.js"></script>
    <script type="text/javascript">
        +function(){
            var $window = $(window), $subnav = $("#subnav"), url;
            $window.resize(function(){
                $("#main").css("min-height", $window.height() - 130);
            }).resize();

            /* 左边菜单高亮 */
            url = window.location.pathname + window.location.search;
            url = url.replace(/(\/(p)\/\d+)|(&p=\d+)|(\/(id)\/\d+)|(&id=\d+)|(\/(group)\/\d+)|(&group=\d+)/, "");
            $subnav.find("a[href='" + url + "']").parent().addClass("current");

            /* 左边菜单显示收起 */
            $("#subnav").on("click", "h3", function(){
                var $this = $(this);
                $this.find(".icon").toggleClass("icon-fold");
                $this.next().slideToggle("fast").siblings(".side-sub-menu:visible").
                      prev("h3").find("i").addClass("icon-fold").end().end().hide();
            });

            $("#subnav h3 a").click(function(e){e.stopPropagation()});

            /* 头部管理员菜单 */
            $(".user-bar").mouseenter(function(){
                var userMenu = $(this).children(".user-menu ");
                userMenu.removeClass("hidden");
                clearTimeout(userMenu.data("timeout"));
            }).mouseleave(function(){
                var userMenu = $(this).children(".user-menu");
                userMenu.data("timeout") && clearTimeout(userMenu.data("timeout"));
                userMenu.data("timeout", setTimeout(function(){userMenu.addClass("hidden")}, 100));
            });

	        /* 表单获取焦点变色 */
	        $("form").on("focus", "input", function(){
		        $(this).addClass('focus');
	        }).on("blur","input",function(){
				        $(this).removeClass('focus');
			        });
		    $("form").on("focus", "textarea", function(){
			    $(this).closest('label').addClass('focus');
		    }).on("blur","textarea",function(){
			    $(this).closest('label').removeClass('focus');
		    });

            // 导航栏超出窗口高度后的模拟滚动条
            var sHeight = $(".sidebar").height();
            var subHeight  = $(".subnav").height();
            var diff = subHeight - sHeight; //250
            var sub = $(".subnav");
            if(diff > 0){
                $(window).mousewheel(function(event, delta){
                    if(delta>0){
                        if(parseInt(sub.css('marginTop'))>-10){
                            sub.css('marginTop','0px');
                        }else{
                            sub.css('marginTop','+='+10);
                        }
                    }else{
                        if(parseInt(sub.css('marginTop'))<'-'+(diff-10)){
                            sub.css('marginTop','-'+(diff-10));
                        }else{
                            sub.css('marginTop','-='+10);
                        }
                    }
                });
            }
        }();
    </script>
    
	<script type="text/javascript" src="/Fund/Public/static/jquery-datetimepicker/jquery-datetimepicker.js"></script>
	<script charset="utf-8" src="/Fund/Public/static/kindeditor/kindeditor-min.js"></script>
	<script charset="utf-8" src="/Fund/Public/static/kindeditor/zh_CN.js"></script>
    <script type="text/javascript">
		KindEditor.ready(function(K) {
			window.editor = K.create('textarea[class="kind-editor"]', {
				allowFileManager : true,
				uploadJson:"<?php echo U('File/kinderUpload');?>",
				minWidth:900,
				minHeight:300,
				afterBlur: function(){this.sync();},
			});
		});
		
		//日期时间插件
    	$('.date_picker').datetimepicker({
    		lang:'ch',
    		format:'Y-m-d',
    		timepicker:false,
    		allowBlank:true
		});
    
		//查询头像文件
		var file = "<?php echo ((isset($trader["avatar_id"]) && ($trader["avatar_id"] !== ""))?($trader["avatar_id"]):0); ?>";
    
		ajaxRequest("<?php echo U('File/fileList1');?>", {"file_type":6}, {"func":function(data){
			//处理查询结果
			var info = '';
			if(data && data.error == 0) {
				//记录已选中图片的url
				st = false;
				$.each(data.info, function(key, val){
					//记录初始图片
					
					//图片列表
					info += '<span class="avatar_file" style="cursor:pointer">';
					info += '<input type="radio" style="vertical-align:middle" value="'+val.id+'" data-url="'+val.url+'" name="avatar_id" ';
					if(file == val.id) {
						info += 'checked';
						st = val.url;
					}
					info += ' /> ' + val.name + '</span>';
					info += '<br/>';
				});
				$("#avatar_id").empty().append(info);
				
				//点击预览
				$('.avatar_file').click(function(){
					var img = '<img src="'+$(this).children('input').data('url')+'" style="max-width:500px;max-height:245px;"/>';
					$("#yu_lan").empty().append(img);
					$(this).children('input').prop('checked', 'true');
				});
				
				//已选中的图片
				if(st != false) $("#yu_lan").empty().append('<img src="'+st+'" style="max-width:500px;max-height:245px;"/>');
			} else {
				$("#avatar_id").empty().append('没有文件');
			}
		}});
		
        //导航高亮
        highlight_subnav('<?php echo U('Trader/traderList');?>');
    </script>

</body>
</html>